package org.cid54.android.jshopper.model;

/**
 *
 * @author fgo
 */
public class ShopItem extends SuperEntityWithName {

    private ShoppingList shoppingList;
    private int amount;
    private boolean bought = false;

    public ShoppingList getShoppingList() {
        return shoppingList;
    }

    public boolean isBought() {
        return bought;
    }

    public void setBought(boolean bought) {
        this.bought = bought;
    }

    public void setShoppingList(ShoppingList shoppingList) {
        this.shoppingList = shoppingList;
    }

    public int getAmount() {
        return amount;
    }

    public void setAmount(int amount) {
        this.amount = amount;
    }

    @Override
    public String toString() {
        return this.getName() + " " + this.getAmount();
    }

    @Override
    public boolean equals(Object o) {
        return o instanceof ShopItem && ((ShopItem) o).getName().equals(this.getName());
    }

    @Override
    public int hashCode() {
        return this.getName().hashCode();
    }
}
